package com.zenithmind.gateway.exception;

import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.reactive.ServerHttpResponse;

/**
 * 错误响应构建器接口
 * 遵循接口隔离原则：专门负责构建错误响应
 * 遵循依赖倒置原则：高层模块依赖抽象而非具体实现
 */
public interface ErrorResponseBuilder {
    
    /**
     * 构建错误响应数据
     * @param response HTTP响应对象
     * @param status HTTP状态码
     * @param message 错误消息
     * @param ex 异常对象
     * @return 响应数据缓冲区
     */
    DataBuffer buildErrorResponse(ServerHttpResponse response, HttpStatus status, String message, Throwable ex);
    
    /**
     * 设置响应头
     * @param response HTTP响应对象
     * @param status HTTP状态码
     */
    void setResponseHeaders(ServerHttpResponse response, HttpStatus status);
}
